//
//  CSGXHeadModel.m
//  CarSalesMS_GCX
//
//  Created by Tony on 2016/10/21.
//  Copyright © 2016年 Tony. All rights reserved.
//

#import "CSGXHeadModel.h"
#import "TUserInfoModel.h"
#import "TUserInfoDAL.h"

@implementation CSGXHeadModel



+ (instancetype)modelWithUserNo:(NSString *)userNo businessNo:(NSString *)businessNo {
    
    TUserInfoModel * userModel = [self userModelWithBusinessNo:businessNo];
    if (userModel == nil) {
        return nil;
    }
    
    CSGXHeadModel * model = [[CSGXHeadModel alloc] init];
    
    model.name = userModel.uUserName;
    model.businessNo = businessNo;
    
    if (userModel.uType == 1) {
        model.nameType = @"商城用户";
    }else {
        model.nameType = @"非商城用户";
    }
    model.otherInfo = @"other informations";
    model.iconImage = [UIImage imageNamed:@"icon"];
    
    return model;
}


+ (TUserInfoModel *)userModelWithBusinessNo:(NSString *)busiNo {
    return [TUserInfoDAL loadUserModelWithBusinessNo:busiNo];
}

+ (instancetype)modelWithUserNo:(NSString *)userNo {
    TUserInfoModel *userModel = [TUserInfoDAL loadUserModelWithUserNo:userNo];
    
    CSGXHeadModel * model = [[CSGXHeadModel alloc] init];
    
    model.name = userModel.uUserName;
    
    if (userModel.uType == 1) {
        model.nameType = @"商城用户";
    }else {
        model.nameType = @"非商城用户";
    }
    model.otherInfo = @"other informations";
    model.iconImage = [UIImage imageNamed:@"icon"];
    
    return model;
}

@end
